package com.codejiwei.core.rdd

import org.apache.spark.{SparkConf, SparkContext}

object Spark_Operator_Type {
  def main(args: Array[String]): Unit = {
    val conf = new SparkConf().setMaster("local[1]").setAppName("OperatorType")
    val sc = new SparkContext(conf)

    val rdd = sc.makeRDD(List(1, 2, 3, 4, 5))

    //Spark的RDD对象包含很多方法，分为两类：
    //1. 转换算子[transform]
    val rdd1 = rdd.map(_ * 2)

    //2. 行动算子[action]
    rdd1.collect().foreach(println)

    sc.stop()
  }
}
